<?php

/*
    Dill is a tool for creating websites with PHP.
    Copyright (C) 2014  Jannik Haberbosch

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

class WebsiteProjectPage extends WebsiteProjectDatabaseElement
{
	private $containers = array();
	private $id;
	private $template;
	private $parent_id;
	private $sort_id;

	
	function __construct( $id, $name, $template, $parent_id, $sort_id,
		$containers )
	{
		$this->id = $id;
		$this->template = $template; // Just a the filename.
		$this->parent_id = $parent_id;
		$this->sort_id = $sort_id;	
		parent::__construct( $name );

		$this->create_containers( $containers );
	}


	private function create_containers( $containers )
	{
		foreach( $containers as $c )
		{
			$this->containers[] = new WebsiteProjectContainer(
				$c["id"],
				$c["name"],
				$c["content"],
				$c["page_id"]
			);
		}
	}


	public function get( $property )
	{
		return $this->$property;
	}


	public function set( $property, $value )
	{
		$this->$property = $value;
	}
}

?>
